package com.xxx.doc;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * indexName:索引库名称
 * type:表名
 *
 * 用户界面需要展示的字段+搜索条件
 */



@Document(indexName = "ymcc",type = "course")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {
    @Id
    private Long id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    @Field(type =FieldType.Double)
    private BigDecimal price;

    @Field(type = FieldType.Keyword)
    private String pic;

    //适用人群
    @Field(type = FieldType.Keyword)
    private String foruser;

    //课程分类
    private Long courseTypeId;

    //课程等级
    @Field(type = FieldType.Keyword)
    private String gradeName;

    //上架时间
    private Date onlineTime;

    //讲师名字
    @Field(type = FieldType.Keyword)
    private String teacherName;

    //课程销售数量
    private Integer saleCount;

    //课程浏览数量
    private Integer viewCount;

    //课程评论数量
    private Integer commentCount;

    /**
     * 收费规则：，收费1免费，2收费
     */
    private Integer charge;
    /**
     * 原价
     */
    private BigDecimal priceOld;

}
